package com.boc_eu.adoweb.adows.adoscript; import java.util.HashSet; import java.util.Iterator; import org.adoxx.adows.client.ADOxxWebService; public class GetModelsXML extends AdoScript { /** * Perform a call to the Documentation message port of ADOxx on the * XML_MODELS operation. Important, the model has to be OPENED. * @param service * @param modelIDs * @param modelgroupIDs * @param inclRecRows */ public GetModelsXML(ADOxxWebService service, HashSet modelIDs, HashSet modelgroupIDs, boolean inclRecRows) { String script = "CC \"Documentation\" XML_MODELS modelids:\"" + getStringToken(modelIDs) + "\" mgroupids:\"" + getStringToken(modelgroupIDs) + "\" no-record-rows:" + (inclRecRows ? "0" : "1"); execute(service, script, "xml"); } /** * Transforms a set of integers to a string token list, space seperated * * @param set * @return StringToken format of the set */ private String getStringToken(HashSet set) { StringBuffer buffer = new StringBuffer(); if (set != null) { Iterator iterator = set.iterator(); while (iterator.hasNext()) { buffer.append(String.valueOf(iterator.next())); if (iterator.hasNext()) buffer.append(" "); } } return buffer.toString(); } }